<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>Mein Wiki Artikel editieren</title>
        <h:outputStylesheet library="css" name="stylesheet.css"/>
    </h:head>
    
    <h:body>
        <div id="wrapper">
            <div id="suche">
                <h:form>
                    <h:inputText id="name" value="#{articleBean.searchText}" required="true" requiredMessage="Keine Eingabe im Suchfeld" styleClass="inputSearch" maxlength="100" autocomplete="on" />
                    <h:commandButton id="cmd" value="Suchen" action="#{articleBean.search()}" styleClass="button"/>
                </h:form>
            </div>
            <h:column rendered="#{user.user}">
            <div id="ausloggen">
                <h:form>
                    <h:commandButton value="Ausloggen" action="#{userBean.logout(user)}" styleClass="button"/>
                </h:form>
            </div>
            </h:column>
            <div id="header">
                <h:form>
                    <h:commandLink action="#{articleBean.goIndex()}">
                        <h:graphicImage styleClass="image"  library="images" name="LOGO-WIKI.jpg" alt="MeinWiki"/>
                    </h:commandLink>
                </h:form>
            </div>
            <div id="menue">
               <h:form>
               <div id="links">
                   <h:commandButton action="#{articleBean.random()}" value="Zufälliger Artikel" styleClass="links">

                   </h:commandButton>
                </div>
                <div id="links">
                    <h:commandButton action="#{articleBean.latestArticle()}" value="Neuster Artikel" styleClass="links" >

                    </h:commandButton>
                    
                </div>
                    <h:column rendered="#{user.boss}">
                    <div id="links">
                    <h:commandButton value="Artikel Erstellen" action="#{articleBean.create()}" styleClass="links" />
                    </div>
                        </h:column>
                </h:form>
            </div>
            <div id="content">
                <h1>#{articleBean.article.theme} editieren</h1>
                <h:form>
                    <h:message for="postSubhead" style="color:red" />
                <h:message for="postText" style="color:red" />
                    <table>
                        <tr>
                            <td> <h3>Unterüberschrift:&nbsp; </h3></td>
                            <td><div style="white-space: pre-wrap"><h:inputText id="postSubhead" value="#{articleBean.postSubhead}" required="true" requiredMessage="Du musst etwas eingeben" styleClass="subHeadline"/></div></td>
                        </tr>
                    <br/><br/>
                        <tr>
                            <td><h3>Text: </h3></td>
                            <td><div style="white-space: pre-wrap"><p:editor  validator="#{articleBean.validateTextForm}" id="postText" value="#{articleBean.postText}"/></div></td>
                        </tr>
                    </table>
                    
                    <div id="uebernehmen">
                        <h:commandButton value="Übernehmen" action="#{articleBean.change(user)}" styleClass="button">
                        <f:param name="id" value="#{articleBean.article.id}"/>
                        <f:param name="oldversionid" value="#{articleBean.oldVersion.versionNumber}"/>
                        <f:param name="postid" value="#{articleBean.post.id}"/>
                        </h:commandButton>
                    </div>
                    
                </h:form>
                <h:form>
                <div id="zurueck">
                        <h:commandButton value="Zurück" action="#{articleBean.goBack()}" styleClass="button">
                              <f:param name="id" value="#{articleBean.article.id}"/>
                              <f:param name="versionid" value="#{articleBean.oldVersion.versionNumber}"/>
                              <f:param name="ebene" value="1"/>
                        </h:commandButton>
                    </div>
                    <h:message for="postText"/>
                    </h:form>
            </div>
            <div id="footer">
                <h:form>
                    <div id="footerlinks">
                        <h:commandLink action="#{articleBean.goImpressum()}">
                            <h:outputText value="Impressum"/>
                        </h:commandLink>
                    </div>
                    <div id="footerlinks">
                        <h:commandLink action="#{articleBean.goKontakt()}">
                            <h:outputText value="Kontakt"/>
                        </h:commandLink>
                    </div>
                </h:form>
            </div>
        </div>
    </h:body>
</html>

